import { ExtractPropTypes } from 'vue'
import { noticeBasicProps, noticeBasicEmits, NoticeModes, NoticeMode } from './type'

/**
 * 通知栏props参数
 */
export const noticeProps = {
  ...noticeBasicProps,
  /** 显示通知 */
  show: {
    type: Boolean,
    default: true
  },
  /** 滚动方向 horizontal 水平滚动 vertical 垂直滚动 */
  mode: {
    type: String,
    default: 'horizontal',
    validator: (value: NoticeMode) => {
      return NoticeModes.includes(value)
    }
  },
  /** 滚动周期间隔, 单位ms */
  duration: {
    type: [String, Number],
    default: 2000
  },
  /** 滚动速度, 每秒滚动多少rpx */
  speed: {
    type: [String, Number],
    default: 160
  },
  /** 当mode为horizontal水平滚动的时候是否采用衔接模式 */
  circular: {
    type: Boolean,
    default: true
  },
  /** 当没有通知时是否自动隐藏 */
  autoHidden: {
    type: Boolean,
    default: true
  }
}
export type NoticeProps = ExtractPropTypes<typeof noticeProps>

export const noticeEmits = {
  ...noticeBasicEmits
}
export type NoticeEmits = typeof noticeEmits
